<?php

namespace App\Models;


use App\Service\Base\Model;
use Illuminate\Support\Facades\DB;

class UserWithdraw extends Model
{

    // 用户管理
    protected $table = 'user_withdraw';

    // 缓存字段，用于搜索绑定的字段
    protected $cacheFields = ['id', 'uid', 'form_uid', 'type',];

    //  {"id":"","uid":"用户ID","form_uid":"一级ID","total":"消费总数","profit":"收益","type":"操作类型：auth：认证 order：订单","description":"描述","ctime":"注册时间","mtime":"更新时间"}


    // array ( 'id' => '$this->getData("id", null, "trim")', 'uid' => '$this->getData("uid", null, "trim")', 'form_uid' => '$this->getData("form_uid", null, "trim")', 'total' => '$this->getData("total", null, "trim")', 'profit' => '$this->getData("profit", null, "trim")', 'type' => '$this->getData("type", null, "trim")', 'description' => '$this->getData("description", null, "trim")', 'ctime' => '$this->getData("ctime", null, "trim")', 'mtime' => '$this->getData("mtime", null, "trim")', )


    // $id = $this->getData("id", null, 'trim'); $uid = $this->getData("uid", null, 'trim'); $form_uid = $this->getData("form_uid", null, 'trim'); $total = $this->getData("total", null, 'trim'); $profit = $this->getData("profit", null, 'trim'); $type = $this->getData("type", null, 'trim'); $description = $this->getData("description", null, 'trim'); $ctime = $this->getData("ctime", null, 'trim'); $mtime = $this->getData("mtime", null, 'trim');

    // 状态
    public function getVerifys()
    {
        return [3 => '完成', 2 => '审核未通过', 1 => '审核通过', 0 => '未审核'];
    }


    // 定义验证操作
    public function rules()
    {

        $add = [
        ];

        $edit = [
        ];

        $info = [
        ];


        $rule = [
            'uid'   => 'required',
            'money' => 'required',
            //'description' => 'required',
        ];


        $msg = [
            'id'          => '',
            'uid'         => '用户ID',
            'money'       => '消费总数',
            'description' => '描述',
            'verify'      => '审核状态',
            'ctime'       => '注册时间',
            'mtime'       => '更新时间',
        ];

        return ['rule' => $rule, 'msg' => $msg, 'add' => $add];
    }
}
